
package com.qin.springcloud.controller;

import com.qin.springcloud.bean.Users;
import com.qin.springcloud.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;


import java.util.List;

@RestController
public class UserController {

    @Autowired
    private UsersService usersService;

    @GetMapping("/users/add")
    public void addUsers(Users users){
          usersService.addUsers(users);
    }
    
    @GetMapping("/users/getone")
    public int getOned(){
         return usersService.getOned();
    }

    @GetMapping("/users/get/{id}")
    public Users getById(@PathVariable int id){
       return usersService.getById(id);
    }

    @GetMapping("/users/getAll")
    public List<Users> getListAll(){
        return usersService.getlistAll();
    }

}

